/**
 * Created by Jimmy on 2018/11/30.
 */
<template>
  <div class="left-menu">
    <el-menu
      default-active="1"
      @select="handleSelect"
      background-color="#333743"
      text-color="#fff"
      active-text-color="#ffd04b"
    >
      <el-menu-item index="1">
        <i class="el-icon-menu"></i>
        <span slot="title">项目管理</span>
      </el-menu-item>
      <el-submenu index="2">
        <template slot="title"><i class="el-icon-document"></i>成本管理</template>
        <el-menu-item index="2-1">用车记录</el-menu-item>
        <el-menu-item index="2-2">项目成本</el-menu-item>
      </el-submenu>
      <el-menu-item index="3">
        <i class="el-icon-edit-outline"></i>
        <span slot="title">产值分配</span>
      </el-menu-item>
      <el-menu-item index="4">
        <i class="el-icon-share"></i>
        <span slot="title">奖金报表</span>
      </el-menu-item>
      <el-menu-item index="5">
        <i class="el-icon-more"></i>
        <span slot="title">人员管理</span>
      </el-menu-item>
      <el-menu-item index="6">
        <i class="el-icon-news"></i>
        <span slot="title">质检审批</span>
      </el-menu-item>
      <el-menu-item index="7">
        <i class="el-icon-setting"></i>
        <span slot="title">其他设置</span>
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script>
export default {
  methods: {
    handleSelect(key, keyPath) {
//      console.log(key)
      if (key === '1'){
        this.$router.push({path: '/panel/project/management'})
      } else if (key === '3') {
        let routeData = this.$router.resolve({
          path: '/panel/project/distribution'
        })
        window.open(routeData.href, '_blank')
      } else if (key === '5') {
        this.$router.push({path: '/panel/project/staff'})
      } else if (key === '6') {
        this.$router.push({path: '/panel/project/quality'})
      } else if (key === '2-1') {
        this.$router.push({path: '/panel/project/car'})
      } else if (key === '2-2') {
        this.$router.push({path: '/panel/project/cost'})
      } else if (key === '7') {
        this.$router.push({path: '/panel/project/setting'})
      } else if (key === '4') {
        let routeData = this.$router.resolve({
          path: '/panel/project/bonus'
        })
        window.open(routeData.href, '_blank')
      }
    }
  }
}
</script>

<style scoped>
  .el-menu{
    position: absolute;
    top: 0;
    left: 0;
    /*bottom: 0;*/
    width: 161px;
    height: 100%;
  }
  .el-submenu .el-menu-item{
    min-width: 161px;
  }
</style>

<!--background-color="#333743"-->
<!--text-color="#fff"-->
<!--active-text-color="#ffd04b"-->
